package org.example;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;

public class TestParse {

    @Test
    public void aaaa() {
        List<String> lsOutput = Arrays.asList(
                "-rw-rw---- 1 u0_a227 media_rw   56 2023-11-27 08:00 log.txt",
                "drwxrws--- 2 u0_a227 media_rw 3.3K 2022-12-27 22:26 taopai"
        );

        for (String line : lsOutput) {
            // 解析文件类型
            boolean isDirectory = line.startsWith("d");
            String fileSize = line.substring(30, 34).trim();
            String lastModifiedStr = line.substring(35, 51);
            String fileName = line.substring(52);

            System.out.println(isDirectory);
            System.out.println(fileSize);
            System.out.println(lastModifiedStr);
            System.out.println(fileName);
        }


    }
}
